//
//  LLMallDoSectionHeader.m
//  LoveLove
//
//  Created by 肖兰月 on 2019/4/6.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "LLMallDoSectionHeader.h"

@interface LLMallDoSectionHeader ()
@property (strong, nonatomic) UILabel *titleLbl;
@property (strong, nonatomic) LLButton *moreBtn;
@end

@implementation LLMallDoSectionHeader

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initSubViews];
    }
    return self;
}

- (void)initSubViews {
    _titleLbl = [LLInitBaseViewTool labelWithText:@"" textColor:UIColor.blackColor font:15 textAlignment:NSTextAlignmentLeft];
    _titleLbl.frame = CGRectMake(12, 0, self.width-100, self.height-1);
    [self addSubview:_titleLbl];
    
    _moreBtn = [LLInitBaseViewTool buttonWithTitle:@"查看更多" image:nil titleColor:LLColorRGB(91) font:15];
    _moreBtn.frame = CGRectMake(self.width-80-12, 0, 80, self.height-1);
    [_moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_moreBtn];
    
    CALayer *separateLine = CALayer.layer;
    separateLine.frame = CGRectMake(0, self.height-1, self.width, 1);
    separateLine.backgroundColor = LLColorRGB(238).CGColor;
    [self.layer addSublayer:separateLine];
}

- (void)setTitle:(NSString *)title {
    _title = title;
    _titleLbl.text = title;
}

- (void)moreBtnClick {
    if ([self.delegate respondsToSelector:@selector(sectionHeaderDidClickMore)]) {
        [self.delegate sectionHeaderDidClickMore];
    }
}

@end
